#pragma once
/**
 * Desc: 求hash
 * Auth: 张宇飞
 * Date: 2015-07-27    
 */

#include <stdint.h>
#include <stdlib.h>

#define ZYFP_MD5_LEN	16

#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t	zyfp_hash_t[2];

extern int	zyfp_hash(const char* s, uint32_t l, zyfp_hash_t out);
/**
 * @brief hash比较函数。a比b小返回小于0的值，a比b大返回大于0的值。
 * 返回0表示相等
 */
extern int32_t	zyfp_hash_cmp(const zyfp_hash_t a, const zyfp_hash_t b);
extern int	zyfp_md5(const char* s, uint32_t l, unsigned char out[ZYFP_MD5_LEN]);

typedef uint32_t (*_user_md5_data_read)(char* buf, uint32_t rl);
extern int	zyfp_usermd5(_user_md5_data_read rfunc, unsigned char out[ZYFP_MD5_LEN]);

#ifdef __cplusplus
} /* end extern C */
#endif

